import * as types from '../constants/ActionTypes';

const initialState = {
  storeName: '',
  storeAddress: '',
  storeInfo: {},
  changeDisCount: {},
  store: '',
  cAddress: '',
};

const myReducer = (state = initialState, action) => {
  switch (action.type) {
    case types.STORE_NAME:
      return ({ ...state,
        ...{
          storeName: action.storeName,
        } });
    case types.STORE_ADDRESS:
      return ({ ...state,
        ...{
          storeAddress: action.storeAddress,
        } });
    case types.STORE_INFO:
      return ({ ...state,
        ...{
          storeInfo: action.storeInfo,
        } });
    case types.CHANGE_DISCOUNT:
      return ({ ...state,
        ...{
          changeDisCount: action.changeDisCount,
        } });
    case types.STORE:
      return ({ ...state,
        ...{
          store: action.store,
        } });
    case types.CHANGE_ADDRESS:
      return ({ ...state,
        ...{
          cAddress: action.cAddress,
        } });
    default:
      return state;
  }
};

export default myReducer;
